@echo off
echo ==========================================
echo   Testing Boot Sequence Step by Step
echo ==========================================
echo.

echo Compiling all debug steps...
echo.

nasm -f bin debug_step1_basic.asm -o step1.bin
if %ERRORLEVEL% NEQ 0 goto error
echo [OK] Step 1: Basic boot

nasm -f bin debug_step2_a20.asm -o step2.bin
if %ERRORLEVEL% NEQ 0 goto error
echo [OK] Step 2: A20

nasm -f bin debug_step3_gdt.asm -o step3.bin
if %ERRORLEVEL% NEQ 0 goto error
echo [OK] Step 3: GDT

nasm -f bin debug_step4_pm_switch.asm -o step4.bin
if %ERRORLEVEL% NEQ 0 goto error
echo [OK] Step 4: PM Switch

nasm -f bin debug_step5_pm_display.asm -o step5.bin
if %ERRORLEVEL% NEQ 0 goto error
echo [OK] Step 5: PM Display

echo.
echo ==========================================
echo All steps compiled successfully!
echo ==========================================
echo.
echo Test each step:
echo   qemu-system-i386 -drive format=raw,file=step1.bin  (expect: 1:OK)
echo   qemu-system-i386 -drive format=raw,file=step2.bin  (expect: 12:A20)
echo   qemu-system-i386 -drive format=raw,file=step3.bin  (expect: 123:GDT)
echo   qemu-system-i386 -drive format=raw,file=step4.bin  (expect: 123 then '4')
echo   qemu-system-i386 -drive format=raw,file=step5.bin  (expect: full message)
echo.
echo Starting from step 1...
pause
qemu-system-i386 -drive format=raw,file=step1.bin
goto end

:error
echo [ERROR] Compilation failed!
pause
exit /b 1

:end

